package com.niit.serviceorder.service;

import com.niit.common.entity.Order;
import com.niit.serviceorder.mapper.OrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    private OrderMapper orderMapper;

    @Override
    public List<Order> getAllOrders() {
       return orderMapper.selectAllOrders();
    }

    @Override
    public Order getOrderById(Long id) {
        return orderMapper.selectOrderById(id);
    }

    @Override
    public Order createOrder(Order order) {
        orderMapper.insertOrder(order);
        return order;
    }

    @Override
    public Order updateOrder(Order order) {
        orderMapper.updateOrder(order);
        return order;
    }

    @Override
    public void deleteOrder(Long id) {
        orderMapper.deleteOrderById(id);
    }
}